<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 寄生组合方式的继承
        function Parent(name) {
            this.name = name
        }

        Parent.prototype.sayName = function () {
            console.log('sayName', this.name)
            return this.name
        }

        function Child() {
            Parent.apply(this, arguments)
        }

        Child.prototype = Object.create(Parent.prototype)

        const child1 = new Child('舒文俊')
        const child2 = new Child('舒文俊1')

        alert(child1.sayName())
        alert(child2.sayName())
    </script>
</body>

</html>